﻿using System;
using System.IO;

namespace Borg.AttributeAnalyze.Result
{
    public class MissingAttribute : ResultBase
    {
        public MissingAttribute(FileInfo file, ResultType result, Type type)
            : base(file, Component.Type, result)
        {
            Type = type;
        }

        public override string ToMsBuildMessageString()
        {
            if (Result == ResultType.MissingSlotOrPlugAttribute)
                return string.Format(
                    "missing attribute \"Slot\" or \"Plug\"\n{1}class: {0}",
                    Type.Name, GetWhiteSpace(2));

            if (Result != ResultType.MissingExtensionAttribute)
                throw new NotImplementedException();
            
            return string.Format(
                "missing attribute \"Extension\"\n{1}class: {0}",
                Type.Name, GetWhiteSpace(2));
        }

        public override MessageType MessageType
        {
            get { return MessageType.Error; }
        }

        public Type Type { get; private set; }

        public override string TypeName
        {
            get { return Type.FullName; }
        }
    }
}

